package cn.tedu.boot22.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BmiController {

    @RequestMapping("/bmi")
    @ResponseBody
    public  String bmi(float height, float weight){

        System.out.println("height = " + height + ", weight = " + weight);

        float bmi = weight / (height * height);

        System.out.println("bmi = "+bmi);

        if (bmi < 18.5) {
            return "过轻";
        }
        if (bmi <= 22.9) {
            return "正常";
        }
        if (bmi <= 24.9) {
            return "偏胖";
        }
        if (bmi <= 29.9) {
            return "肥胖";
        }
        if (bmi <= 40) {
            return "重度肥胖";
        }
        return "极度肥胖";
    }
}
